# ==============================
# _*_ coding:utf-8 _*_
# _*_ by:zizle     _*_
# _*_ at:20230423  _*_
# ==============================
from .database import BaseDatabaseConnection, IndexDataBaseConnection, DepartmentDataBaseConnection, RedisConnection


def create_sql(item: dict):
    sql_columns = ''
    for k, v in item.items():
        sql_columns += f'{k}=%({k})s,'
    sql_columns = sql_columns[:-1] + ' '
    return sql_columns


def exclude_columns(item: dict, includes: list):
    # 删除不能更新的字段
    excludes = []
    for k, v in item.items():
        if k not in includes:
            excludes.append(k)
    for k in excludes:
        del item[k]
    return item
